﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace DAL
{
    public abstract class PhieunhapDAL:BaseDAL,IBase
    {
        #region IBase Members

        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(object obj, int skip, int take)
        {
            throw new NotImplementedException();
        }

        public object Insert(object obj)
        {
            throw new NotImplementedException();
        }

        public object Update(object obj)
        {
            throw new NotImplementedException();
        }

        public object Delete(Guid id)
        {
            throw new NotImplementedException();
        }

        #endregion

        public bool Phieunhap_Insert(DAL.Entities.Phieunhap pn)
        {
            try
            {
                _sqlMapper.Insert("Phieunhap_Insert", pn);
                return true;
            }
            catch (Exception a)
            {
                return false;
            }
        }

        public DataTable Phieunhap_NCC_Select_Conno_By_Id_NCCNgay(DAL.Entities.Phieunhap pn)
        {
            return Mapper.QueryForDataTable("Phieunhap_NCC_Select_Conno_By_Id_NCCNgay", pn, "Temp");
        }

        public DataTable Phieunhap_Select_Taoma(string SubMa)
        {
            return Mapper.QueryForDataTable("Phieunhap_Select_Taoma", SubMa, "Temp");
        }

        public DataTable Phieunhap_Select_ChitietThongtinPhieunhap(Guid Id_Phieunhap)
        {
            return Mapper.QueryForDataTable("Phieunhap_Select_ChitietThongtinPhieunhap", Id_Phieunhap, "Temp");
        }

        public DataTable PhieunhapLayThongtin1(Guid Id)
        {
            return Mapper.QueryForDataTable("PhieunhapLayThongtin1", Id, "Temp");
        }

        public bool Phieunhap_CapnhatTratien(DAL.Entities.Phieunhap pn)
        {
            try
            {
                _sqlMapper.Update("Phieunhap_CapnhatTratien", pn);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Phieunhap_Delete(Guid Id)
        {
            try
            {
                _sqlMapper.Delete("Phieunhap_Delete", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
